package jannex.sql.extensions;

import jannex.Jannex;
import jannex.internal.ExceptionFactory;
import jannex.sql.JxRef;

import java.sql.Ref;
import java.sql.SQLException;
import java.util.Map;

public class RefImpl implements JxRef {

    private Ref ref;
    private Jannex jannex;

    public RefImpl(Ref ref, Jannex jannex) {
        this.ref = ref;
        this.jannex = jannex;
    }

    @Override
    public String getBaseTypeName() {
        try {
            return ref.getBaseTypeName();
        } catch (SQLException e) {
            throw ExceptionFactory.make(e);
        }
    }

    @Override
    public Object getObject(Map<String, Class<?>> map) {
        try {
            return ref.getObject(map);
        } catch (SQLException e) {
            throw ExceptionFactory.make(e);
        }
    }

    @Override
    public Object getObject() {
        try {
            return ref.getObject();
        } catch (SQLException e) {
            throw ExceptionFactory.make(e);
        }
    }

    @Override
    public void setObject(Object value) {
        try {
            ref.setObject(value);
        } catch (SQLException e) {
            throw ExceptionFactory.make(e);
        }
    }
}
